
#ifndef RTCHANNELHTTPSERVERACCEPTOR_H
#define RTCHANNELHTTPSERVERACCEPTOR_H

#include "RtConnectionInterface.h"
#include "RtReferenceControl.h"
#include "RtHttpInterface.h"

class /*RT_API_EXPORT*/ CRtChannelHttpServerAcceptor 
	: public IRtChannelServerAcceptor
	, public CRtReferenceControlSingleThread
	, public IRtAcceptorConnectorSink
{
public:
	CRtChannelHttpServerAcceptor(CRtChannelManager::CFlag aFlag);
	virtual ~CRtChannelHttpServerAcceptor();

	// interface IRtReferenceControl
	virtual DWORD AddReference();
	virtual DWORD ReleaseReference();

	// interface IRtChannelServerAcceptor
	virtual RtResult StartListen(
		IRtChannelServerSink *aSink,
		const CRtInetAddr &aAddrListen);

	virtual RtResult StopListen(RtResult aReason);

	// interface IRtAcceptorConnectorSink
	virtual void OnConnectIndication(
		RtResult aReason,
		IRtTransport *aTrpt,
		IRtAcceptorConnectorId *aRequestId);

private:
	IRtChannelServerSink *m_pSink;
	CRtAutoPtr<IRtAcceptor> m_pAcceptorTcp;
	CRtChannelManager::CFlag m_FlagAcceptor;
};

#endif // !RTCHANNELHTTPSERVERACCEPTOR_H
